package com.wxzz.elearning.common.vo;

import com.github.pagehelper.PageInfo;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * 精工要求分页返回格式
 */
@Data
@NoArgsConstructor
public class JgPageVo<T> {

    private Long count;
    private Integer curIndex;
    private List data;
    private Integer firstIndex;
    private Integer lastIndex;
    private Integer nextIndex;
    private Integer pageSize;
    private Integer pagesCount;
    private Integer preIndex;

    public JgPageVo(PageInfo pageInfo) {
        count = pageInfo.getTotal();
        curIndex = pageInfo.getPageNum();
        data = pageInfo.getList();
        firstIndex = pageInfo.getNavigateFirstPage();
        lastIndex = pageInfo.getNavigateLastPage();
        nextIndex = pageInfo.getNextPage();
        pageSize = pageInfo.getSize();
        pagesCount = pageInfo.getPages();
        preIndex = pageInfo.getPrePage();
    }
}
